#include "Generate_C_std.h"
#include "Pattern_assign_var.h"

class Pattern_assign_expr_bin_op : public Pattern_assign_var
{
public:
	Expr* rhs_pattern()
	{
		left = new Wildcard<Rvalue>;
		op = new Wildcard<OP>;
		right = new Wildcard<Rvalue>;

		return new Bin_op (left, op, right); 
	}

	void generate_code (Generate_C* gen)
	{
		assert (lhs);
		assert (op_functions.has (*op->value->value));
		assert (!agn->is_ref);

		string op_fn = op_functions[*op->value->value];

		INST (buf, "assign_expr_bin_op",
				lhs->value, left->value, right->value, s(op_fn));
	}


protected:
	Wildcard<Rvalue>* left;
	Wildcard<OP>* op;
	Wildcard<Rvalue>* right;
};

CREATE(Pattern_assign_expr_bin_op);
